package com.oracle.calligraphy.controller;

import com.oracle.calligraphy.entity.ArtorEntity;
import com.oracle.calligraphy.service.ArtorService;
import com.oracle.common.utils.PageUtils;
import com.oracle.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 *
 *
 * @author oracle
 * @email @qq.com
 * @date 2024-07-05 15:21:49
 */
@RestController
@RequestMapping("calligraphy/artor")
public class ArtorController {
    @Autowired
    private ArtorService artorService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = artorService.queryPage(params);

        return R.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")

    public R info(@PathVariable("id") Long id){
		ArtorEntity artor = artorService.getById(id);

        return R.ok(artor);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody ArtorEntity artor){
		artorService.save(artor);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")

    public R update(@RequestBody ArtorEntity artor){
		artorService.updateById(artor);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Long[] ids){
		artorService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
